package cn.edu.scnu.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;
import org.springframework.session.web.http.CookieHttpSessionIdResolver;
import org.springframework.session.web.http.HttpSessionIdResolver;

/**
 * 配置Spring Session和Redis
 */
@Configuration
@EnableRedisHttpSession
public class RedisHttpSessionConfig {
    // TODO: 配置redis
    // 1. 创建Redis连接工厂
    // 2. 配置HttpSession
    // 3. 配置Session的过期时间
    // 4. 配置Session的存储方式
    // 5. 配置Session的序列化方式
        @Bean
        public HttpSessionIdResolver httpSessionIdResolver() {
            return new CookieHttpSessionIdResolver();
        }

}
